import {
  SysTenantListGetResultModel,
  SysTenantListParams,
  sysTenant,
} from './model/sysTenantModel';
import { defHttp } from '/@/utils/http/axios';

const prefix = '/linsir-saas-server/v2/sysTenant/';

enum Api {
  SYSTENANT_LIST = prefix + 'list',
  SYSTENANT_ADD = prefix + 'add',
  SYSTENANT_DEL = prefix + 'del',
  SYSTENANT_GET = prefix + 'get',
  SYSTENANT_GENERATECODE = prefix + 'generateCode',
}

// 获取租户列表
export const sysTenantListApi = (params: SysTenantListParams) =>
  defHttp.get<SysTenantListGetResultModel>({
    url: Api.SYSTENANT_LIST,
    params,
  });

//增加租户
export const sysTenantAddApi = (params: sysTenant) =>
  defHttp.post<boolean>({
    url: Api.SYSTENANT_ADD,
    params,
  });

// 删除租户信息
export const sysTenantDelApi = (params: number) =>
  defHttp.get<boolean>({
    url: Api.SYSTENANT_DEL + '/' + params,
  });

// 获取用户
export const sysTenantGetApi = (params) =>
  defHttp.get<sysTenant>({
    url: Api.SYSTENANT_GET + '/' + params,
  });

//获取租户编码
export const sysTenantGenerateCodeApi = () =>
  defHttp.get<string>({ url: Api.SYSTENANT_GENERATECODE });
